package com.liveinstars.account.business.exception;

import com.onepiece.shipelves.common.Result;
import com.onepiece.shipelves.common.enums.BaseExceptionEnum;
import lombok.Getter;

/**
 * @author: ting
 * @date: 2020/3/26
 */
@Getter
public enum AccountExceptionEnum implements BaseExceptionEnum {

    IS_EMPTY("20080000", "数据为空"),
    ENTITY_NOT_FOUND("20080001", "对象不存在"),
    BIND_ACCOUNT_ERROR("20080002", "绑定账号失败"),
    LOGIN_ACCOUNT_ERROR("20080004", "登录失败"),
    VALID_ACCOUNT_ERROR("20080003", "验证账号失败"),
    REQUEST_ERROR("20080005", "请求信息错误"),
    ACCOUNT_EXIST("20080006", "账号已经存在"),
    MOBILE_EXIST("20080007", "手机号已经被绑定");
    private String code;

    private String message;

    AccountExceptionEnum(String code, String message) {
        this.code = code;
        this.message = message;
    }


    @Override
    public Result createResult() {
        Result result = new Result();
        result.setCode(this.code);
        result.setMessage(this.message);
        return result;
    }

    @Override
    public String getExceptionCode() {
        return this.getCode();
    }

    @Override
    public String getExceptionMessage() {
        return this.getMessage();
    }
}
